


import ch.qos.logback.classic.encoder.PatternLayoutEncoder
import ch.qos.logback.core.ConsoleAppender
import ch.qos.logback.core.rolling.RollingFileAppender
import ch.qos.logback.core.rolling.TimeBasedRollingPolicy

import static ch.qos.logback.classic.Level.DEBUG
import static ch.qos.logback.classic.Level.INFO

def commonPattern = "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %X{GlobalTrackId} - %msg%n"
def logFilePrefix = '/home/mlogs/mlogs_test'
def logFileSuffix = '.log'

appender("FILE", RollingFileAppender) {
    file = "${logFilePrefix}${logFileSuffix}"
    rollingPolicy(TimeBasedRollingPolicy) {
        fileNamePattern = "${logFilePrefix}.%d{yyyyMMdd}${logFileSuffix}"
        maxHistory = 30
    }
    encoder(PatternLayoutEncoder) {
        pattern = commonPattern
    }
}

appender("STDOUT", ConsoleAppender) {
    encoder(PatternLayoutEncoder) {
        pattern = commonPattern
    }
}

//logger("groovyx.net.http", ERROR)

//logger("com.msite",  DEBUG)
//logger("com.ibatis", DEBUG)
//logger("com.ibatis.common.jdbc.SimpleDataSource", DEBUG)
//logger("com.ibatis.common.jdbc.ScriptRunner", DEBUG)
//logger("com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate", DEBUG)
//logger("java.sql.Connection", DEBUG)
//logger("java.sql.Statement", DEBUG)
//logger("java.sql.PreparedStatement", DEBUG)

logger("com.mybatis", DEBUG)
logger("com.mybatis.spring", INFO)
logger("org.springframework", INFO)
logger("org.apache", INFO)
logger("httpclient.wire", INFO)

root(DEBUG, ["STDOUT", "FILE"])
